| API Documentation |  |

- MAIN PAGE
- NAMESPACES
- CLASSES

Public Member Functions | List of all members
nkGraphics::ViewportManager Class Referencefinal

Manages the viewports available in the component. More...

Inheritance diagram for nkGraphics::ViewportManager:

## Public Member Functions
Viewport * | getActiveViewport () const
void | setActiveViewport (Viewport *value)
Viewport * | createOrRetrieve (nkMemory::StringView name)
Viewport * | get (nkMemory::StringView name) const
Viewport * | getByIndex (unsigned int index) const
void | rename (nkMemory::StringView currentName, nkMemory::StringView newName)
void | erase (nkMemory::StringView name)

## Detailed Description

Manages the viewports available in the component.

At all times, the manager owns the memory it allocates. External code should never delete it.

## Member Function Documentation

## ◆ getActiveViewport()

Viewport* nkGraphics::ViewportManager::getActiveViewport | ( |  | ) | const

Returns
  The currently active viewport.

## ◆ setActiveViewport()

void nkGraphics::ViewportManager::setActiveViewport | ( | Viewport * | value | ) |

Sets currently active viewport for the pass. This is used during rendering to keep track of what is active and feed shaders with the right information.

Parameters

  value | The viewport active.

## ◆ createOrRetrieve()

Viewport* nkGraphics::ViewportManager::createOrRetrieve | ( | nkMemory::StringView | name | ) |

Creates if unavailable, or retrieve if available, viewport attached with given name.

Parameters

  name | The name of the viewport to retrieve.

Returns
  The viewport, possibly freshly created. The manager owns memory returned, external code should never free it.

## ◆ get()

Viewport* nkGraphics::ViewportManager::get | ( | nkMemory::StringView | name | ) | const

Retrives an existing viewport.

Parameters

  name | The name of the viewport to retrieve.

Returns
  The viewport requested if available, nullptr else.

## ◆ getByIndex()

Viewport* nkGraphics::ViewportManager::getByIndex | ( | unsigned int | index | ) | const

Accesses a viewport, by index in the manager memory. Note that an index can point to different viewport after manipulating the manager memory (add or remove viewports). This function mainly serves to go over all existing viewports in one go.

Parameters

  index | The index of the viewport to retrieve.

Returns
  The viewport requested if available, nullptr else.

## ◆ rename()

void nkGraphics::ViewportManager::rename | ( | nkMemory::StringView | currentName,
|  | nkMemory::StringView | newName
| ) |  |

Renames a viewport from one name to another.

Parameters

  currentName | The name of the viewport to rename.
  newName | The new name to assign to the viewport/

## ◆ erase()

void nkGraphics::ViewportManager::erase | ( | nkMemory::StringView | name | ) |

Erases a viewport and frees its memory.

Parameters

  name | The name of the viewport to erase.

The documentation for this class was generated from the following file:

- Documentation/Headers/NilkinsGraphics/Viewports/ViewportManager.h